package regex.a02demo2;

public class Test1 {
    public static void main(String[] args) {
        String redex1 = "(.).+\\1";
        System.out.println("a123456a".matches(redex1));
        System.out.println("a123456b".matches(redex1));
        System.out.println("a12a".matches(redex1));

        System.out.println("-----------------");

        String redex2 = "(.+).+\\1";
        System.out.println("aaaa123456aaaa".matches(redex2));
        System.out.println("ab123456ab".matches(redex2));
        System.out.println("ac12abc".matches(redex2));

        System.out.println("-----------------");

        String redex3 = "((.)\\2*).+\\1";
        System.out.println("aaa12aaa".matches(redex3));
        System.out.println("abc12abc".matches(redex3));
        System.out.println("ac12ab".matches(redex3));
    }
}
